#pragma once

#include "FastCGIConfig.h"

#define KB(__num__) (__num__ * 1024)

// 缓存
class FCGI_Cache {
public:
	FCGI_Cache();
	FCGI_Cache(const FCGI_Cache &cache);
	virtual ~FCGI_Cache();

public:
	void *Data();
	u_int Size();

	bool Empty();

public:
	// 压入
	void Push(void *data, u_int size);
	// 弹出
	void Pop(void *data, u_int size, bool direction = true);
	void Pop(FCGI_Cache *data, u_int size, bool direction = true);
	// 寻找
	u_int Find(void *data, u_int size);
	// 清空
	void Flush();

protected:
	void *data;
	u_int size;
};